#pragma strict

var isReplace:boolean;
var rootBipPrefab:Transform;

var bonesReplacer:BonesReplacer;
private var tr:Transform;
function Start () {
	tr = transform;
}

function Update () {
	if(isReplace){
		isReplace = false;
		if(rootBipPrefab){
			var rootBip:Transform = Instantiate(rootBipPrefab);
			rootBip.parent = tr.parent;
			rootBip.localPosition = Vector3.zero;
			bonesReplacer = gameObject.AddComponent.<BonesReplacer>();
			bonesReplacer.rootTransform = rootBip;
		}
	}
}